<template>
	<div id="subtmpl">
		<div class="left" @click="down">-</div>
		<div class="center" v-text="count"></div>
		<div class="right" @click="add">+</div>
	</div>
</template>

<script>
	export default{
		data(){
			return{
				count:1,
			}
		},
		methods:{
			down(){
				this.count--;
				if(this.count<1){
					this.count=1;
				}
				this.sendmessage();
			},
			add(){
				this.count++;
				this.sendmessage()
			},
			sendmessage(){
				this.$emit('dataobj',this.count)
			}
		}
	}
</script>

<style scoped>
	#subtmpl div{
		border: 1px solid red;
		width: 36px;
		height: 30px;
		line-height: 30px;
		display: inline-block;
	}
	#subtmpl{
		text-align: center;
		}
</style>